#include "../Headers/day04.h"
op::op(int val)
{
    this->val = val;
}
op::~op()
{
}
op op ::operator+(op &rhs)
{

    return op(this->val + rhs.val);
}
int operator-(op &lhs, op &rhs)
{
    return lhs.val - rhs.val;
}
int operator>(op &lhs, op &rhs)
{
    if (lhs.val > rhs.val)
    {
        return 1;
    }
    return 0;
}
int operator==(op &lhs, op &rhs)
{
    if (lhs.val == rhs.val)
    {
        return 1;
    }
    return 0;
}
int op ::getval()
{
    return val;
}

op op::operator++(int x)
{ // x为了区分前缀++和后缀++；
    op temp = *this;
    this->val++;
    return temp;
}
ostream &operator<<(ostream &out, op &rhs)
{
    out << rhs.val;
    return out;
}

myString::myString(const char *p_new)
{
    this->len = strlen(p_new) + 1;
    this->p = new char[this->len];
    strcpy(this->p, p_new);
}
myString ::myString(const myString &str)
{
    this->len = strlen(str.p) + 1;
    this->p = new char[this->len];
    strcpy(this->p, str.p);
}
myString ::~myString()
{
    delete[] this->p;
    p = NULL;
}
myString &myString::operator+(myString rhs)
{
    strcat(this->p, rhs.p);
    return *this;
}
int myString::operator==(myString rhs)
{
    return strcmp(this->p, rhs.p);
}
char myString::operator[](int offset)
{
    return this->p[offset];
}
ostream &operator<<(ostream &out, myString &rhs)
{
    out << rhs.p;
    return out;
}
